#include <iostream>
using namespace std;

const int kMaxNum = 1e6 + 10;
int diff[kMaxNum], num[kMaxNum];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;

  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;

    cin >> a >> b;
    a++;
    b++;
    diff[a]++;
    diff[b + 1]--;
  }

  int ans = 0;
  for (int i = 1; i < kMaxNum; i++) {
    num[i] = num[i - 1] + diff[i];
    ans = max(num[i], ans);
  }
  cout << ans << "\n";
  return 0;
}